import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home
  },
  {
    path: "/login",
    name: "Login",
    component: require("../views/Login").default
  },
  {
    path: "/register",
    name: "Register",
    component: require("../views/Register").default
  },
  {
    path: "/dashboard",
    component: require("../views/Dashboard").default,
    children: [
      {
        name: "Dashboard",
        path: "",
        component: require("../views/dashboard/Index").default
      },
      {
        path: "skus",
        component: require("../views/dashboard/Skus").default
      },
      {
        path: "skus_create",
        component: require("../views/dashboard/SkusCreate").default
      },
      {
        path: "skus/:id",
        component: require("../views/dashboard/SkusShow").default
      }
    ]
  },
  {
    path: "/admin",
    component: require("../views/Admin").default,
    children: [
      {
        name: "Admin",
        path: "",
        component: require("../views/admin/Index").default
      },
      {
        path: "sku",
        component: require("../views/admin/Sku").default
      },
      {
        path: "sku/:id",
        component: require("../views/admin/SkuShow").default
      }
    ]
  }
];

const router = new VueRouter({
  routes,
  linkActiveClass: "active"
});

export default router;
